package com.xxxx.seckill.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.xxxx.seckill.VO.LoginVO;
import com.xxxx.seckill.VO.ResponseBean;
import com.xxxx.seckill.pojo.User;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author Jack
 * @since 2024-01-20
 */
public interface IUserService extends IService<User> {

    /**
     * 功能描述：登录
     *
     * @param loginVO:
     * @param request:
     * @param response:
     * @return :
     */
    ResponseBean doLogin(LoginVO loginVO, HttpServletRequest request, HttpServletResponse response);

    /**
     * 根据 Cookie 获取用户
     * 一开始是为了解决分布式情况下用户不一致的问题
     * 实际上，也对用户进行了一层缓存，后期都是从 Redis 中获取的
     *
     * @param ticket:
     * @param request:
     * @param response:
     * @return :
     */
    User getUserByCookie(String ticket, HttpServletRequest request, HttpServletResponse response);

    /**
     * 更新密码
     *
     * @param userTicket:
     * @param password:
     * @param request:
     * @param response:
     * @return :
     */
    ResponseBean updatePassword(String userTicket, String password, HttpServletRequest request, HttpServletResponse response);

}
